import request from '@/utils/request';

// 根据用户id和商家id查询购物车
export const listCartByUserIdAndBusinessIdService = (params) => {
  return request({
    url: '/cart/listByUserIdAndBusinessId',
    method: 'get',
    params: params
  });
};

// 根据用户id查询购物车
export const listCartByUserIdService = (params) => {
  return request({
    url: '/cart/listByUserId',
    method: 'get',
    params: params
  });
};

// 添加购物车
export const addCartService = (data) => {
  return request({
    url: '/cart',
    method: 'post',
    data: data
  });
};

// 更新购物车
export const updateCartService = (data) => {
  return request({
    url: '/cart',
    method: 'put',
    data: data
  });
};

// 删除购物车
export const deleteCartService = (cartId) => {
  return request({
    url: `/cart/${cartId}`,
    method: 'delete'
  });
};

// 添加到购物车
export const addToCart = (data) => {
  return request({
    url: '/cart',
    method: 'post',
    data
  })
} 